﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Santa_sAdventure.Model
{
    class Bullet
    {
        // Varibles
        private Vector2 m_position;
        private Vector2 m_velocity;
        private SpriteEffects flip = SpriteEffects.None;

        internal Bullet(Vector2 a_position, Vector2 a_velocity)
        {
            m_position = a_position;
            m_velocity = a_velocity;
            Size = new Vector2(0.5f, 0.2f);
        }

        // Bullet Position
        internal Vector2 Position { get { return m_position; } }

        // Bullet Velocity
        internal Vector2 Velocity { get { return m_velocity; } }

        // Bullet Size
        internal Vector2 Size { get; set; }

        // Update
        internal void Update(float a_timeElapsedInSec)
        {
            m_position = Position + Velocity * a_timeElapsedInSec;
        }

        // Return spriteeffects
        internal SpriteEffects GetSpriteEffect()
        {
            // Flip the sprite to face the way we are moving.
            if (Velocity.X > 0)
                flip = SpriteEffects.FlipHorizontally;
            else if (Velocity.X < 0)
                flip = SpriteEffects.None;

            return flip;
        }
    }
}
